// pages/pyq/pyq.js
Page({

  /**
   * 页面的初始数据
   */
  data: {
    menu: [
      {id:1,icon:"moment", name:"朋友圈", lastline:true, new:"白起"},
      {id:2,icon:"videos", name:"视频号", lastline:true, new:false},
      {id:3,icon:"music", name:"听音乐", lastline:false, new:false},
      {id:4,icon:"scan", name:"扫一扫", lastline:false, new:false},
      {id:5,icon:"shake", name:"识别", lastline:true, new:false},
      {id:6,icon:"look", name:"看一看", lastline:false, new:false},
      {id:7,icon:"search", name:"天气", lastline:true, new:false},
      {id:8,icon:"shop", name:"购物", lastline:false, new:false},
      {id:9,icon:"game", name:"游戏", lastline:true, new:false},
      {id:10,icon:"miniprog", name:"小程序", lastline:true, new:false},
    ],
    value:''
  },
  chooseView(e){
    console.log(e);
    let id = e.currentTarget.dataset.id;
    switch (id){
      case 3:
      wx.navigateTo({
        url: '../musicHome/musicHome',
      })
      case 1:
      wx.navigateTo({
        url: '../friends/friends',
      })
      case 4:
      wx.navigateTo({
        url: '../scan/scan',
      })
      case 7:
      wx.navigateTo({
        url: '../weather/weather',
      })
      case 8:
      wx.navigateTo({
        url: '../shop/shop',
      })
      case 9:
      wx.navigateTo({
        url: '../game/game',
      })
      case 10:
        wx.navigateTo({
          url: '../home/home',
        })
      case 5:
      wx.navigateTo({
        url: '../scanQR/scanQR',
      })
      break;
      case 6:
        wx.navigateTo({
          url: '../news/news',
        })
        break;
        case 2:
        wx.navigateTo({
          url: '../video/video',
        })
        break;
      default:
        break;
    }
   
    this.setData({
      value:id
    })
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    for (var i = 0; i < this.data.menu.length; i++) {
      if (this.data.menu[i].new) {
        wx.showTabBarRedDot({
          index: 2,
        })
      }
    }
  },
  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {

  }
})